//
//  ViewController.m
//  1506changecolor
//
//  Created by student on 16/2/19.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)backTap:(id)sender
{
    [self.view endEditing:YES];
}

- (void)changecolor
{
    [self.UIview setBackgroundColor:[UIColor colorWithRed:[self.textField1.text floatValue]/255.0 green:[self.textField2.text floatValue]/255.0 blue:[self.textField3.text floatValue]/255.0 alpha:255/255.0]];
}


- (IBAction)slider1change:(UISlider *)sender
{
    int value = sender.value;
    self.textField1.text = [NSString stringWithFormat:@"%i",value];
    [self changecolor];
}

- (IBAction)slider2change:(UISlider *)sender
{
    int value = sender.value;
    self.textField2.text = [NSString stringWithFormat:@"%i",value];
    [self changecolor];
}

- (IBAction)slider3change:(UISlider *)sender
{
    int value = sender.value;
    self.textField3.text = [NSString stringWithFormat:@"%i",value];
    [self changecolor];
}
- (IBAction)TextredChange:(UITextField *)sender
{
    int value = [sender.text floatValue];
    self.slider1.value = value;
    [self changecolor];
}

- (IBAction)TextgreenChange:(UITextField *)sender
{
    int value = [sender.text floatValue];
    self.slider2.value = value;
    [self changecolor];
}

- (IBAction)TextblueChange:(UITextField *)sender
{
    int value = [sender.text floatValue];
    self.slider3.value = value;
    [self changecolor];
}
@end
